## 14.9. Alphabetical Summary of RCS Commands

For details on the syntax of keywords, revision numbers, dates, states, and standard options, refer to the previous discussions.

> ci | ci [options] files Check in revisions. ci stores the contents of the specified working files into their corresponding RCS files. Normally, ci deletes the working file after storing it. If no RCS file exists, then the working file is an initial revision. In this case, the RCS file is created and you are prompted to enter a description of the file. If an RCS file exists, ci increments the revision number and prompts you to enter a message that logs the changes made. Starting with RCS Version 5.6, if a working file is checked in without changes, the file reverts to the previous revision. In older RCS versions, you may end up having to check in a new revision that contains no changes. The mutually exclusive options -u, -l, and -r are the most common. Use -u to keep a read-only copy of the working file (for example, so that the file can be compiled or searched). Use -l to update a revision and then immediately check it out again with a lock. This allows you to save intermediate changes but continue editing (for example, during a long editing session). Use -r to check in a file with a different release number. ci accepts the standard options -q, -V, -x, and -z. #### Options -d[date] Check the file in with a timestamp of date or, if no date is specified, with the time of last modification. -f[R] Force a checkin even if there are no differences. -I[R] Interactive mode; prompt user even when standard input is not a terminal (e.g., when ci is part of a command pipeline). -I was new in RCS Version 5. -i[R] Create (initialize) an RCS file and check it in. A warning is reported if the RCS file already exists. -j[R] Check in a file without initializing. Will report an error if file does not already exist. -k[R] Assign a revision number, creation date, state, and author from keyword values that were placed in the working file, instead of computing the revision information from the local environment. -k is useful for software distribution: the preset keywords serve as a timestamp shared by all distribution sites. -l[R] Do a co -l after checking in. This leaves a locked copy of the next revision. -m msg Use the msg string as the log message for all files checked in. When checking in multiple files, ci normally prompts whether to reuse the log message of the previous file. -m bypasses this prompting. -M[R] Set the working file's modification time to that of the retrieved version. Use of -M can confuse make and should be used with care. (This was new in RCS Version 5.6.) -n name Associate a text name with the new revision number. -N name Same as -n, but override a previous name. -r[R] Check the file in as revision R. -r By itself, reverts to default behavior when releasing a lock and removing the working file. This option overrides any -l or -u options that have been initialized by shell aliases or scripts. This behavior for -r is specific to ci. -s state Set the state of the checked-in revision. -T Set the RCS file's modification time to the time of the latest revision if the RCS file's time precedes the new revision. -t file Replace RCS file description with contents of file. As of Version 5, this works only for initial checkin. -t-string Replace RCS file description with string. As of Version 5, this works only for initial checkin. -u[R] Do a co -u after checking in. This leaves a read-only copy. -w user Set the author field to user in the checked-in revision. #### Examples Check in chapter files using the same log message:
>     ci -m'First round edits' chap*
> Check in edits to prog.c, leaving a read-only copy:
>     ci -u prog.c
> Start revision level 2; refer to revision 2.1 as "Prototype":
>     ci -r2 -nPrototype prog.c
> co | co [options] files Retrieve a previously checked-in revision, and place it in the corresponding working file (or print to standard output if -p is specified). If you intend to edit the working file and check it in again, specify -l to lock the file. co accepts the standard options -q, -V, and -x. #### Options -d date Retrieve latest revision whose checkin timestamp is on or before date. -f[R] Force the working file to be overwritten. -I[R] Interactive mode; prompt user even when standard input is not a terminal. (New in RCS Version 5.) -j R2:R3 This works like rcsmerge. R2 and R3 specify two revisions whose changes are merged into a third file: either the corresponding working file or a third revision (any R specified by other co options). -k c Expand keyword symbols according to flag c. c can be: b Like o, but performs its operations in binary mode, generating the previous revision's keywords and values in binary. k Expand symbols to keywords only (no values). This is useful for ignoring trivial differences during file comparison. kv Expand symbols to keyword and value (the default). Insert the locker's name only during a ci -l or co -l. kvl Like kv, but always insert the locker's name. o Expand symbols to keyword and value present in previous revision. This is useful for binary files that don't allow substring changes. v Expand symbols to values only (no keywords). This prevents further keyword substitution and is not recommended. -l[R] Same as -r, but also lock the retrieved revision. -M[R] Set the working file's modification time to that of the retrieved version. Use of -M can confuse make and should be used with care. (This was new in RCS Version 5.6.) -p[R] Send retrieved revision to standard output instead of to a working file. Useful for output redirection or filtering. -r[R] Retrieve the latest revision or, if R is given, retrieve the latest revision that is equal to or lower than R. -s state Retrieve the latest revision having the given state. -T Preserve the modification time of the RCS file even if a lock is added or removed. -u[R] Same as -r, but also unlock the retrieved revision if you locked it previously. -w[user] Retrieve the latest revision that was checked in either by the invoking user or by the specified user. #### Examples Sort the latest stored version of file:
>     co -p file | sort
> Check out (and lock) all uppercase filenames for editing:
>     co -l [A-Z]*
> Note that filename expansion fails unless a working copy resides in the current directory. Therefore, this example works only if the files were previously checked in via ci -u. Finally, here are some different ways to extract the working files for a set of RCS files (in the current directory):
>     co -r3 *,v                  Latest revisions of release 3
>     co -r3 -wjim *,v            Same, but only if checked in by jim
>     co -d'May 5, 2 pm LT' *,v   Latest revisions that were modified on or before the date
>     co -rPrototype *,v          Latest revisions named Prototype
> ident | ident [option] [files] Extract keyword/value symbols from files. files can be text files, object files, or dumps. #### Option -q Suppress warning message when no keyword patterns are found. #### Examples If file prog.c is compiled, and it contains this line of code:
>     char rcsID[] = "$Author: ellie $";
> then the following output is produced:
>     % ident prog.c prog.o
>     prog.c:
>          $Author: ellie $
>     prog.o:
>          $Author: ellie $
> Show keywords for all RCS files (suppress warnings):
>     co -p RCS/*,v | ident -q
> rcs | rcs [options] <files An administrative command for setting up or changing the default attributes of RCS files. Among other things, rcs lets you set strict locking (-L), delete revisions (-o), and override locks set by co (-l and -u). RCS files have an access list (created via -a); anyone whose username is on the list can run rcs. The access list is often empty, meaning that rcs is available to everyone. In addition, you can always invoke rcs if you own the file, if you're a privileged user, or if you run rcs with -i. rcs accepts the standard options -q, -V, -x, and -z. #### Options -a users Append the comma-separated list of users to the access list. -A otherfile Append otherfile's access list to the access list of files. -b[R] Set the default branch to R or, if R is omitted, to the highest branch on the trunk. -c`s' The comment character for $Log keywords is set to string s. By default, co expands embedded $Log keywords into comments preceded by #. You could, for example, set s to .\" for troff files or set s to * for C programs. (You would need to manually insert an enclosing /* and */ before and after $Log.) -e[users] Erase everyone (or only the specified users) from the access list. -i Create (initialize) an RCS file, but don't deposit a revision. -I Interactive mode; prompt user even when standard input is not a terminal. (New in RCS Version 5.) -k c Use c as the default style for keyword substitution. (See co for values of c.) -kkv restores the default substitution style; all other styles create incompatibilities with RCS Version 4 or earlier. -l[R Lock revision R or the latest revision. -l "retroactively locks" a file and is useful if you checked out a file incorrectly by typing co instead of co -l. -L Turn on strict locking (the default). This means that everyone, including the owner of the RCS file, must use co -l to edit files. Strict locking is recommended when files are to be shared. (See -U.) -m R:msg Use the msg string to replace the log message of revision R. (This was new in RCS Version 5.6.) -M Disable email notification when breaking a lock on a file with rcs -u. This should only be used when there is another means to warn users that their files have been unlocked. -n flags Add or delete an association between a revision and a name. flags can be: name:R Associate name with revision R. name: Associate name with latest revision. name Remove association of name. -Nflags Same as -n, but overwrite existing names. -o R_list Delete (outdate) revisions listed in R_list. R_list can be specified as R1, R1-R2, R1-, or -R2. When a branch is given, -o deletes only the latest revision on it. RCS Version 5.6 changed the range separator character to :, although - is still valid. -s state[:R] Set the state of revision R (or the latest revision) to the word state. -t[file] Replace RCS file description with contents of file or, if no file is given, with standard output. -t-string Replace RCS file description with string. Preserves the time of modification on an RCS file unless a revision is removed. -T Preserve the modification time of the RCS file. -u[R] The complement of -l: unlock a revision that was previously checked out via co -l. If someone else did the checkout, you are prompted to state the reason for breaking the lock. This message is mailed to the original locker. -U Turn on nonstrict locking. Everyone except the file owner must use co -l to edit files. (See -L.) -V Print the RCS version number. -z zone Set the default time zone for timestamp options performed by the ci and co commands. #### Examples Associate the label To_customer with the latest revision of all RCS files:
>     rcs -nTo_customer: RCS/*
> Add three users to the access list of file beatle_deals:
>     rcs -ageorge,paul,ringo beatle_deals
> Delete revisions 1.2 through 1.5:
>     rcs -o1.2-1.5 doc
> Replace an RCS file description with the contents of a variable:
>     echo "$description" | rcs -t file
> rcsclean | rcsclean [options] [files] Compare checked-out files against the corresponding latest revision or revision R (as given by the options). If no differences are found, the working file is removed. (Use rcsdiff to find differences.) rcsclean is useful in makefiles. For example, you could specify a "clean-up" target to update your directories. rcsclean is also useful prior to running rcsfreeze. rcsclean accepts the standard options -q, -V, -x, and -z. #### Options -k c When comparing revisions, expand keywords using style c. (See co for values of c.) -n[R] Show what would happen, but don't actually execute. -r[R] Compare against revision R. R can be supplied as arguments to other options, so -r is redundant. -T Preserve the modification time of the RCS file even if a lock is added or removed. -u[R] Unlock the revision if it's the same as the working file. #### Examples Remove unchanged copies of program and header files:
>     rcsclean *.c *.h
> rcsdiff | rcsdiff [options] [diff_options] files Compare revisions via diff. Specify revisions using -r as follows:
>          Number of
>          Revisions Specified:    Comparison Made:
>        None                       Working file against latest revision
>        One                         Working file against specified revision
>        Two                         One revision against the other
rcsdiff accepts the standard options -q, -T, -V, -x, and -z, as well as diff_options, which can be any valid diff option. rcsdiff exits with a status of 0 (no differences), 1 (some differences), or 2 (unknown problem). #### Options -k c When comparing revisions, expand keywords using style c. (See co for values of c.) -r R1 Use revision R1 in the comparison. -r R2 Use revision R2 in the comparison. (-r R1 must also be specified.)
> rcsmerge | rcsmerge [options] file Perform a three-way merge of file revisions, taking two differing versions and incorporating the changes into the working file. You must provide either one or two revisions to merge (typically with -r). Overlaps are handled the same as with merge, by placing warnings in the resulting file. rcsmerge accepts the standard options -q, -V, -x, and -z. rcsmerge exits with a status of 0 (no overlaps), 1 (some overlaps), or 2 (unknown problem). #### Options -k c When comparing revisions, expand keywords using style c. (See co for values of c.) -p[R] Send merged version to standard output instead of overwriting file. -r[R] Merge revision R or, if no R is given, merge the latest revision. #### Examples Suppose you need to add updates to an old revision (1.3) of prog.c, but the current file is already at revision 1.6. To incorporate the changes:
>     co -l prog.c
>     (edit latest revision by adding revision 1.3 updates, then:)
>     rcsmerge -p -r1.3 -r1.6 prog.c > prog.updated.c
> Undo changes between revisions 3.5 and 3.2, and overwrite the working file:
>     rcsmerge -r3.5 -r3.2 chap08
> rlog | rlog [options] files Display identification information for RCS files, including the log message associated with each revision, the number of lines added or removed, date of last checkin, and so on. With no options, rlog displays all information. Use options to display specific items. rlog accepts the standard options -T, -V, -x, and -z. #### Options -b Prune the display; print only about the default branch. -d dates Display information for revisions whose checkin timestamp falls in the range of dates (a list separated by semicolons). Be sure to use quotes. Each date can be specified as: date1<date2 Select revisions between date1 and date2, inclusive. date1 < Select revisions made on or after date1. date1 Select revisions made on or before date1. -h Display the beginning of the normal rlog listing. -l[users] Display information only about locked revisions or, if lockers is specified, only revisions locked by the list of users. -L Skip files that aren't locked. -N Don't display symbolic names. -r[list] Display information for revisions in the comma-separated list of revision numbers. If no list is given, the latest revision is used. Items can be specified as: R1 Select revision R1. If R1 is a branch, select all revisions on it. R1`.` If R1 is a branch, select its latest revision. R1-R2 Select revisions R1 through R2. -R1 Select revisions from beginning of branch through R1. R1- Select revisions from R1 through end of branch. RCS Version 5.6 changed the range separator character to :, although - is still valid. -R Display only the name of the RCS file. -s states Display information for revisions whose state matches one from the comma-separated list of states. -t Same as -h, but also display the file's description. -w[users] Display information for revisions checked in by anyone in the comma-separated list of users. If no users are supplied, assume the name of the invoking user. #### Examples Display a file's revision history:
>     rlog RCS/*,v | more
> Display names of RCS files that are locked by user daniel:
>     rlog -R -L -ldaniel RCS/*
> Display the "title" portion (no revision history) of a working file:
>     rlog -t calc.c

Copyright © 2001 O'Reilly & Associates. All rights reserved.